#pragma once
#include <string>
#include "curl.h"

class FtpClient {
public:
    FtpClient(const std::string& user = "", const std::string& pass = "");
    ~FtpClient();

    // Global init/cleanup (call once in main or managed by uploader)
    static void globalInit();
    static void globalCleanup();

    // Create a CURL* configured to upload from a FILE* (fopen).
    // Caller must ensure filePtr remains valid until curl_easy_perform returns.
    CURL* createUploadSessionWithFILE(const std::string& url, FILE* filePtr, long fileSize);

    // Create remote directory. dirUrl must be full ftp URL like ftp://host/path
    // Attempts to create and delete a dummy file (best-effort).
    bool createRemoteDir(const std::string& dirUrl);

private:
    std::string m_user;
    std::string m_pass;
};
